/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Principal.java
 *
 * Created on 06/08/2011, 02:14:59 PM
 */

package proyectocatalina;


import CapadeDatos.ConexionBD;
import CapadeDatos.DaoUsuariosSistemas;
import java.awt.Component;
import java.awt.Container;
import java.io.File;
import java.util.ArrayList;
import proyectocatalina.verotros.carrera;
import proyectocatalina.verotros.modulos;
import modelo.beanusuario;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Iterator;
import java.util.StringTokenizer;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.ImageIcon;
import javax.swing.JDesktopPane;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.UnsupportedLookAndFeelException;
import javax.swing.filechooser.FileNameExtensionFilter;
import modelo.beanPermisos;
import proyectocatalina.reportes.ejecutarficha;
import proyectocatalina.tablasystem.*;


/**
 *
 * @author principal
 */
public class Principal extends javax.swing.JFrame implements Runnable{
public static JDesktopPane panel;
String hora = "vacio" ,minutos = "vacio",segundos  = "vacio",ampm = "vacio";
Calendar calendario;
Thread h1;
       FichadeMatricula alumno;
       AlumnosporSemestre alumno2;
       carrera carrera;
       modulos modulos;
 BuscarAlumno buscar;
 modificarusuarios system;
 proyectocatalina.mantenimiento.carrera carrera2;
 proyectocatalina.mantenimiento.familiacarrera familycarrera;
 proyectocatalina.mantenimiento.modulos modulos2;
 proyectocatalina.mantenimiento.periodo_lectivo periodo2;
 proyectocatalina.mantenimiento.turno turno2;
 proyectocatalina.mantenimiento.unidad unidad2;
 beanusuario User;
    /** Creates new form Principal */
    public Principal() throws UnsupportedLookAndFeelException, Exception {
       initComponents();
       this.setIconImage (new ImageIcon(getClass().getResource("/Imagenes/huarango.jpg")).getImage());
       h1 = new Thread(this);
       h1.start();
       jfecha.setText(new Calendario().fechaactual());
       this.setExtendedState(Principal.MAXIMIZED_BOTH);
       this.setLocationRelativeTo(null);
       User = Login.usuarioglobal;
       activarpermiso();



       jcargo.setText(" "+User.getUsuario());
       this.setTitle("Sistema Integrado de Matricula - IEST CBP - (SIMCBP)"+" - Sesion Iniciada por: "+User.getApellidoPaterno()+" "
                     + User.getApellidoMaterno()+" "+User.getNombres());
       panel = jdesktop;
        buscar = new BuscarAlumno();
    }


    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel3 = new javax.swing.JLabel();
        jButton13 = new javax.swing.JButton();
        jf = new javax.swing.JFileChooser();
        jToolBar1 = new javax.swing.JToolBar();
        jLabel1 = new javax.swing.JLabel();
        jSeparator1 = new javax.swing.JToolBar.Separator();
        jLabel4 = new javax.swing.JLabel();
        jcargo = new javax.swing.JLabel();
        jSeparator2 = new javax.swing.JToolBar.Separator();
        jButton1 = new javax.swing.JButton();
        jSeparator3 = new javax.swing.JToolBar.Separator();
        jButton2 = new javax.swing.JButton();
        jSeparator4 = new javax.swing.JToolBar.Separator();
        jLabel7 = new javax.swing.JLabel();
        jfecha = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jSeparator5 = new javax.swing.JToolBar.Separator();
        jLabel6 = new javax.swing.JLabel();
        Jhora = new javax.swing.JLabel();
        jPanel1 = new javax.swing.JPanel();
        jmenu = new javax.swing.JTabbedPane();
        tabmatricula = new javax.swing.JPanel();
        jPanel10 = new javax.swing.JPanel();
        newalumno = new javax.swing.JButton();
        jPanel16 = new javax.swing.JPanel();
        matricular = new javax.swing.JButton();
        tabconsultas = new javax.swing.JPanel();
        jPanel13 = new javax.swing.JPanel();
        jbtncarrera = new javax.swing.JButton();
        jbtnmodulo = new javax.swing.JButton();
        jPanel14 = new javax.swing.JPanel();
        jalumnoporsemestre1 = new javax.swing.JButton();
        jalumnoporsemestre = new javax.swing.JButton();
        jPanel20 = new javax.swing.JPanel();
        jalumnoporsemestre2 = new javax.swing.JButton();
        tabreportes = new javax.swing.JPanel();
        jPanel21 = new javax.swing.JPanel();
        reportenomina = new javax.swing.JButton();
        jfichamatricula = new javax.swing.JButton();
        tabadministracion = new javax.swing.JPanel();
        jPanel17 = new javax.swing.JPanel();
        jbtnmodifcardatos = new javax.swing.JButton();
        jretiraralumno = new javax.swing.JButton();
        jButton4 = new javax.swing.JButton();
        jPanel18 = new javax.swing.JPanel();
        jitinerario = new javax.swing.JButton();
        jcarreraad = new javax.swing.JButton();
        jperiodoad = new javax.swing.JButton();
        jsemestread = new javax.swing.JButton();
        jmodulosad = new javax.swing.JButton();
        junidadesad = new javax.swing.JButton();
        jturnosad = new javax.swing.JButton();
        jcondicionad = new javax.swing.JButton();
        jrelacionarad = new javax.swing.JButton();
        jPanel22 = new javax.swing.JPanel();
        jorgterritorialad = new javax.swing.JButton();
        jactividadesad = new javax.swing.JButton();
        jcolegioad = new javax.swing.JButton();
        tabmantenimiento = new javax.swing.JPanel();
        jPanel8 = new javax.swing.JPanel();
        jregistrarusuario = new javax.swing.JButton();
        jmodusuario = new javax.swing.JButton();
        jlistadousuario = new javax.swing.JButton();
        jactividaddiaria = new javax.swing.JButton();
        jPanel11 = new javax.swing.JPanel();
        jpermisosagre = new javax.swing.JButton();
        jnuevopermiso = new javax.swing.JButton();
        jButton3 = new javax.swing.JButton();
        jPanel12 = new javax.swing.JPanel();
        jbackup = new javax.swing.JButton();
        jPanel15 = new javax.swing.JPanel();
        jfaq = new javax.swing.JButton();
        jsoporte = new javax.swing.JButton();
        jdesktop = new javax.swing.JDesktopPane();

        jLabel3.setText("jLabel3");

        jButton13.setText("Registrar Matricula por alumno");
        jButton13.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
        jButton13.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);

        jf.setCurrentDirectory(new java.io.File("D:\\BackupsBDCatalina"));
        jf.setDialogType(javax.swing.JFileChooser.SAVE_DIALOG);

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Sistema Integrado de Registro y Matricula");
        setMinimumSize(new java.awt.Dimension(0, 600));

        jToolBar1.setRollover(true);
        jToolBar1.setPreferredSize(new java.awt.Dimension(100, 25));

        jLabel1.setFont(new java.awt.Font("Tahoma", 1, 11));
        jLabel1.setText("Instituto de Educacion Superior Tecnologica Publico - Catalina Buendia de Pecho   ");
        jToolBar1.add(jLabel1);
        jToolBar1.add(jSeparator1);

        jLabel4.setFont(new java.awt.Font("Tahoma", 1, 11));
        jLabel4.setText("   Sesion inciada como:");
        jToolBar1.add(jLabel4);

        jcargo.setText("CARGO                      ");
        jToolBar1.add(jcargo);
        jToolBar1.add(jSeparator2);

        jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/cerrar-sesion-icono-5977-64.png"))); // NOI18N
        jButton1.setText("Cerrar Sesion");
        jButton1.setFocusable(false);
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });
        jToolBar1.add(jButton1);
        jToolBar1.add(jSeparator3);

        jButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/aa.png"))); // NOI18N
        jButton2.setText("Acerca de");
        jButton2.setFocusable(false);
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });
        jToolBar1.add(jButton2);
        jToolBar1.add(jSeparator4);

        jLabel7.setText("             ");
        jToolBar1.add(jLabel7);

        jfecha.setText("Miercoles 07 de Julio del 2011");
        jToolBar1.add(jfecha);

        jLabel8.setText("             ");
        jToolBar1.add(jLabel8);
        jToolBar1.add(jSeparator5);

        jLabel6.setFont(new java.awt.Font("Tahoma", 1, 11));
        jLabel6.setText("Hora:  ");
        jToolBar1.add(jLabel6);

        Jhora.setText("jLabel7");
        Jhora.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        Jhora.setVerifyInputWhenFocusTarget(false);
        jToolBar1.add(Jhora);

        getContentPane().add(jToolBar1, java.awt.BorderLayout.PAGE_END);

        jPanel1.setOpaque(false);
        jPanel1.setPreferredSize(new java.awt.Dimension(853, 160));
        jPanel1.setRequestFocusEnabled(false);

        jmenu.setMinimumSize(new java.awt.Dimension(112, 200));
        jmenu.setPreferredSize(new java.awt.Dimension(890, 300));

        tabmatricula.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N

        jPanel10.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Registrar Alumno nuevo", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.BOTTOM, new java.awt.Font("Tahoma", 1, 11), new java.awt.Color(153, 102, 0))); // NOI18N

        newalumno.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/people.png"))); // NOI18N
        newalumno.setText("Nuevo alumno");
        newalumno.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        newalumno.setVerticalAlignment(javax.swing.SwingConstants.TOP);
        newalumno.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        newalumno.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                newalumnoActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel10Layout = new javax.swing.GroupLayout(jPanel10);
        jPanel10.setLayout(jPanel10Layout);
        jPanel10Layout.setHorizontalGroup(
            jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel10Layout.createSequentialGroup()
                .addContainerGap(22, Short.MAX_VALUE)
                .addComponent(newalumno, javax.swing.GroupLayout.PREFERRED_SIZE, 148, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        jPanel10Layout.setVerticalGroup(
            jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel10Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(newalumno)
                .addContainerGap())
        );

        jPanel16.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Matriculas", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.BOTTOM, new java.awt.Font("Tahoma", 1, 11), new java.awt.Color(153, 102, 0))); // NOI18N

        matricular.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/matricula.png"))); // NOI18N
        matricular.setText("Matricular");
        matricular.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        matricular.setVerifyInputWhenFocusTarget(false);
        matricular.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
        matricular.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        matricular.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                matricularActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel16Layout = new javax.swing.GroupLayout(jPanel16);
        jPanel16.setLayout(jPanel16Layout);
        jPanel16Layout.setHorizontalGroup(
            jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel16Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(matricular, javax.swing.GroupLayout.PREFERRED_SIZE, 149, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(21, Short.MAX_VALUE))
        );
        jPanel16Layout.setVerticalGroup(
            jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel16Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(matricular, javax.swing.GroupLayout.PREFERRED_SIZE, 65, Short.MAX_VALUE)
                .addContainerGap())
        );

        javax.swing.GroupLayout tabmatriculaLayout = new javax.swing.GroupLayout(tabmatricula);
        tabmatricula.setLayout(tabmatriculaLayout);
        tabmatriculaLayout.setHorizontalGroup(
            tabmatriculaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(tabmatriculaLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel16, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(822, Short.MAX_VALUE))
        );
        tabmatriculaLayout.setVerticalGroup(
            tabmatriculaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, tabmatriculaLayout.createSequentialGroup()
                .addGroup(tabmatriculaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jPanel16, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel10, javax.swing.GroupLayout.DEFAULT_SIZE, 114, Short.MAX_VALUE))
                .addGap(10, 10, 10))
        );

        jmenu.addTab("Matricula", new javax.swing.ImageIcon(getClass().getResource("/Imagenes/prazos_de_preinscripcion_e_matricula_na_escola_oficial_de_idiomas_curso_2011_12_icono.png")), tabmatricula); // NOI18N

        jPanel13.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Otros", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.BOTTOM, new java.awt.Font("Tahoma", 1, 11), new java.awt.Color(153, 102, 0))); // NOI18N

        jbtncarrera.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/conocimientos2.png"))); // NOI18N
        jbtncarrera.setText("Carreras Profesionales");
        jbtncarrera.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jbtncarrera.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jbtncarrera.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtncarreraActionPerformed(evt);
            }
        });

        jbtnmodulo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/modulos.png"))); // NOI18N
        jbtnmodulo.setText("Modulos/Unidades");
        jbtnmodulo.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jbtnmodulo.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jbtnmodulo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtnmoduloActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel13Layout = new javax.swing.GroupLayout(jPanel13);
        jPanel13.setLayout(jPanel13Layout);
        jPanel13Layout.setHorizontalGroup(
            jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel13Layout.createSequentialGroup()
                .addComponent(jbtncarrera)
                .addGap(18, 18, 18)
                .addComponent(jbtnmodulo, javax.swing.GroupLayout.PREFERRED_SIZE, 137, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel13Layout.setVerticalGroup(
            jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel13Layout.createSequentialGroup()
                .addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jbtnmodulo, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 75, Short.MAX_VALUE)
                    .addComponent(jbtncarrera, javax.swing.GroupLayout.DEFAULT_SIZE, 75, Short.MAX_VALUE))
                .addContainerGap())
        );

        jPanel14.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Alumnos", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.BOTTOM, new java.awt.Font("Tahoma", 1, 11), new java.awt.Color(153, 102, 0))); // NOI18N

        jalumnoporsemestre1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/alumno.png"))); // NOI18N
        jalumnoporsemestre1.setText("Buscar Alumno");
        jalumnoporsemestre1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jalumnoporsemestre1.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jalumnoporsemestre1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jalumnoporsemestre1ActionPerformed(evt);
            }
        });

        jalumnoporsemestre.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/formacionprofesionales_los-alumnos-de-hoy-son-peores-que-los-de-antano.png"))); // NOI18N
        jalumnoporsemestre.setText("Listado de Alumnos");
        jalumnoporsemestre.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jalumnoporsemestre.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jalumnoporsemestre.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jalumnoporsemestreActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel14Layout = new javax.swing.GroupLayout(jPanel14);
        jPanel14.setLayout(jPanel14Layout);
        jPanel14Layout.setHorizontalGroup(
            jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel14Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jalumnoporsemestre1, javax.swing.GroupLayout.PREFERRED_SIZE, 137, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jalumnoporsemestre)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel14Layout.setVerticalGroup(
            jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel14Layout.createSequentialGroup()
                .addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jalumnoporsemestre1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 75, Short.MAX_VALUE)
                    .addComponent(jalumnoporsemestre, javax.swing.GroupLayout.DEFAULT_SIZE, 75, Short.MAX_VALUE))
                .addContainerGap())
        );

        jPanel20.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Ver Estadisticas", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.BOTTOM, new java.awt.Font("Tahoma", 1, 11), new java.awt.Color(153, 102, 0))); // NOI18N

        jalumnoporsemestre2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/Estadisticas.png"))); // NOI18N
        jalumnoporsemestre2.setText("Ver Estadisticas");
        jalumnoporsemestre2.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jalumnoporsemestre2.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jalumnoporsemestre2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jalumnoporsemestre2ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel20Layout = new javax.swing.GroupLayout(jPanel20);
        jPanel20.setLayout(jPanel20Layout);
        jPanel20Layout.setHorizontalGroup(
            jPanel20Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel20Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jalumnoporsemestre2, javax.swing.GroupLayout.PREFERRED_SIZE, 122, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        jPanel20Layout.setVerticalGroup(
            jPanel20Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel20Layout.createSequentialGroup()
                .addComponent(jalumnoporsemestre2, javax.swing.GroupLayout.DEFAULT_SIZE, 75, Short.MAX_VALUE)
                .addContainerGap())
        );

        javax.swing.GroupLayout tabconsultasLayout = new javax.swing.GroupLayout(tabconsultas);
        tabconsultas.setLayout(tabconsultasLayout);
        tabconsultasLayout.setHorizontalGroup(
            tabconsultasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(tabconsultasLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel14, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jPanel13, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jPanel20, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(400, Short.MAX_VALUE))
        );
        tabconsultasLayout.setVerticalGroup(
            tabconsultasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(tabconsultasLayout.createSequentialGroup()
                .addGroup(tabconsultasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel13, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel20, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel14, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );

        jmenu.addTab("Consultas", new javax.swing.ImageIcon(getClass().getResource("/Imagenes/rayo-de-energia-icono-6292-96.png")), tabconsultas); // NOI18N

        jPanel21.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Generar Reportes", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.BOTTOM, new java.awt.Font("Tahoma", 1, 11), new java.awt.Color(153, 102, 0))); // NOI18N

        reportenomina.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/icono_descarga.jpg"))); // NOI18N
        reportenomina.setText(" Nomina de Matricula");
        reportenomina.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        reportenomina.setVerticalAlignment(javax.swing.SwingConstants.TOP);
        reportenomina.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        reportenomina.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                reportenominaActionPerformed(evt);
            }
        });

        jfichamatricula.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/matricula_datos.png"))); // NOI18N
        jfichamatricula.setText("Ficha de Matricula ");
        jfichamatricula.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jfichamatricula.setVerticalAlignment(javax.swing.SwingConstants.TOP);
        jfichamatricula.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jfichamatricula.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jfichamatriculaActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel21Layout = new javax.swing.GroupLayout(jPanel21);
        jPanel21.setLayout(jPanel21Layout);
        jPanel21Layout.setHorizontalGroup(
            jPanel21Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel21Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(reportenomina, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jfichamatricula, javax.swing.GroupLayout.DEFAULT_SIZE, 150, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel21Layout.setVerticalGroup(
            jPanel21Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jfichamatricula, javax.swing.GroupLayout.DEFAULT_SIZE, 86, Short.MAX_VALUE)
            .addComponent(reportenomina, javax.swing.GroupLayout.DEFAULT_SIZE, 86, Short.MAX_VALUE)
        );

        javax.swing.GroupLayout tabreportesLayout = new javax.swing.GroupLayout(tabreportes);
        tabreportes.setLayout(tabreportesLayout);
        tabreportesLayout.setHorizontalGroup(
            tabreportesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(tabreportesLayout.createSequentialGroup()
                .addGap(20, 20, 20)
                .addComponent(jPanel21, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(852, Short.MAX_VALUE))
        );
        tabreportesLayout.setVerticalGroup(
            tabreportesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(tabreportesLayout.createSequentialGroup()
                .addComponent(jPanel21, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );

        jmenu.addTab("Reportes", new javax.swing.ImageIcon(getClass().getResource("/Imagenes/vista-preliminar-del-documento-icono-6420-96.png")), tabreportes); // NOI18N

        jPanel17.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Administrar matriculas y alumnos", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.BOTTOM, new java.awt.Font("Tahoma", 1, 11), new java.awt.Color(153, 102, 0))); // NOI18N

        jbtnmodifcardatos.setText("Modificar Datos del Alumno");
        jbtnmodifcardatos.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtnmodifcardatosActionPerformed(evt);
            }
        });

        jretiraralumno.setText("Retirar alumno / Dar de Baja");

        jButton4.setText("Modificar Matricula");
        jButton4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton4ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel17Layout = new javax.swing.GroupLayout(jPanel17);
        jPanel17.setLayout(jPanel17Layout);
        jPanel17Layout.setHorizontalGroup(
            jPanel17Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel17Layout.createSequentialGroup()
                .addGroup(jPanel17Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(jbtnmodifcardatos, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jretiraralumno, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 227, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButton4, javax.swing.GroupLayout.DEFAULT_SIZE, 183, Short.MAX_VALUE))
        );
        jPanel17Layout.setVerticalGroup(
            jPanel17Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel17Layout.createSequentialGroup()
                .addGroup(jPanel17Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jbtnmodifcardatos)
                    .addComponent(jButton4))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jretiraralumno)
                .addContainerGap(34, Short.MAX_VALUE))
        );

        jPanel18.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Administrar Itinerario Formativo", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.BOTTOM, new java.awt.Font("Tahoma", 1, 11), new java.awt.Color(153, 102, 0))); // NOI18N

        jitinerario.setText("Itinerario");
        jitinerario.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
        jitinerario.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jitinerario.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jitinerarioActionPerformed(evt);
            }
        });

        jcarreraad.setText("Carreras");
        jcarreraad.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jcarreraadActionPerformed(evt);
            }
        });

        jperiodoad.setText("Periodo Lectivo");
        jperiodoad.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jperiodoadActionPerformed(evt);
            }
        });

        jsemestread.setText("Semestre");
        jsemestread.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jsemestreadActionPerformed(evt);
            }
        });

        jmodulosad.setText("Modulos");
        jmodulosad.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmodulosadActionPerformed(evt);
            }
        });

        junidadesad.setText("Unidades");
        junidadesad.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                junidadesadActionPerformed(evt);
            }
        });

        jturnosad.setText("Turnos");
        jturnosad.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jturnosadActionPerformed(evt);
            }
        });

        jcondicionad.setText("Condicion");
        jcondicionad.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jcondicionadActionPerformed(evt);
            }
        });

        jrelacionarad.setText("Relacionar");
        jrelacionarad.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jrelacionaradActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel18Layout = new javax.swing.GroupLayout(jPanel18);
        jPanel18.setLayout(jPanel18Layout);
        jPanel18Layout.setHorizontalGroup(
            jPanel18Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel18Layout.createSequentialGroup()
                .addComponent(jitinerario)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel18Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jperiodoad, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jcarreraad, javax.swing.GroupLayout.DEFAULT_SIZE, 102, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel18Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jmodulosad, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jsemestread, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel18Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jturnosad, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(junidadesad, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel18Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jcondicionad, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jrelacionarad, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap(19, Short.MAX_VALUE))
        );
        jPanel18Layout.setVerticalGroup(
            jPanel18Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel18Layout.createSequentialGroup()
                .addGroup(jPanel18Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jitinerario, javax.swing.GroupLayout.DEFAULT_SIZE, 75, Short.MAX_VALUE)
                    .addGroup(jPanel18Layout.createSequentialGroup()
                        .addGroup(jPanel18Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jcarreraad)
                            .addComponent(jsemestread)
                            .addComponent(junidadesad)
                            .addComponent(jcondicionad))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel18Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jperiodoad)
                            .addComponent(jmodulosad)
                            .addComponent(jturnosad)
                            .addComponent(jrelacionarad))))
                .addContainerGap())
        );

        jPanel22.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Otros datos", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.BOTTOM, new java.awt.Font("Tahoma", 1, 11), new java.awt.Color(153, 102, 0))); // NOI18N

        jorgterritorialad.setText("Org Territorial");
        jorgterritorialad.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
        jorgterritorialad.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jorgterritorialad.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jorgterritorialadActionPerformed(evt);
            }
        });

        jactividadesad.setText("Listado de Actividades");
        jactividadesad.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jactividadesadActionPerformed(evt);
            }
        });

        jcolegioad.setText("Listado de Colegios");
        jcolegioad.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jcolegioadActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel22Layout = new javax.swing.GroupLayout(jPanel22);
        jPanel22.setLayout(jPanel22Layout);
        jPanel22Layout.setHorizontalGroup(
            jPanel22Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel22Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jorgterritorialad)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel22Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jactividadesad)
                    .addComponent(jcolegioad, javax.swing.GroupLayout.DEFAULT_SIZE, 139, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanel22Layout.setVerticalGroup(
            jPanel22Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel22Layout.createSequentialGroup()
                .addGroup(jPanel22Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jorgterritorialad, javax.swing.GroupLayout.DEFAULT_SIZE, 75, Short.MAX_VALUE)
                    .addGroup(jPanel22Layout.createSequentialGroup()
                        .addComponent(jactividadesad)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jcolegioad)))
                .addContainerGap())
        );

        javax.swing.GroupLayout tabadministracionLayout = new javax.swing.GroupLayout(tabadministracion);
        tabadministracion.setLayout(tabadministracionLayout);
        tabadministracionLayout.setHorizontalGroup(
            tabadministracionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, tabadministracionLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel17, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGap(18, 18, 18)
                .addComponent(jPanel18, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel22, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        tabadministracionLayout.setVerticalGroup(
            tabadministracionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, tabadministracionLayout.createSequentialGroup()
                .addGroup(tabadministracionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jPanel22, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel17, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel18, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );

        jmenu.addTab("Administracion", new javax.swing.ImageIcon(getClass().getResource("/Imagenes/engranaje.png")), tabadministracion); // NOI18N

        tabmantenimiento.setEnabled(false);

        jPanel8.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Administracion de usuarios", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.BOTTOM, new java.awt.Font("Tahoma", 1, 11), new java.awt.Color(153, 102, 0))); // NOI18N
        jPanel8.setForeground(new java.awt.Color(255, 255, 255));

        jregistrarusuario.setText("Registrar");
        jregistrarusuario.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
        jregistrarusuario.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jregistrarusuario.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jregistrarusuarioActionPerformed(evt);
            }
        });

        jmodusuario.setText("Modificar/ Eliminar usuario");
        jmodusuario.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmodusuarioActionPerformed(evt);
            }
        });

        jlistadousuario.setText("Ver listado de usuarios");
        jlistadousuario.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jlistadousuarioActionPerformed(evt);
            }
        });

        jactividaddiaria.setText("Actividad Diaria");
        jactividaddiaria.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jactividaddiariaActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
        jPanel8.setLayout(jPanel8Layout);
        jPanel8Layout.setHorizontalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel8Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jregistrarusuario, javax.swing.GroupLayout.PREFERRED_SIZE, 103, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel8Layout.createSequentialGroup()
                        .addComponent(jmodusuario)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jlistadousuario, javax.swing.GroupLayout.PREFERRED_SIZE, 155, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jactividaddiaria, javax.swing.GroupLayout.DEFAULT_SIZE, 322, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanel8Layout.setVerticalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel8Layout.createSequentialGroup()
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel8Layout.createSequentialGroup()
                        .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jmodusuario)
                            .addComponent(jlistadousuario))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jactividaddiaria))
                    .addComponent(jregistrarusuario, javax.swing.GroupLayout.PREFERRED_SIZE, 62, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel11.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Administracion de permisos", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.BOTTOM, new java.awt.Font("Tahoma", 1, 11), new java.awt.Color(153, 102, 0))); // NOI18N

        jpermisosagre.setText("Asignar permisos");
        jpermisosagre.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
        jpermisosagre.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jpermisosagre.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jpermisosagreActionPerformed(evt);
            }
        });

        jnuevopermiso.setText("Administrar Permisos");
        jnuevopermiso.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jnuevopermisoActionPerformed(evt);
            }
        });

        jButton3.setText("Ver Permisos por usuario");
        jButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton3ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel11Layout = new javax.swing.GroupLayout(jPanel11);
        jPanel11.setLayout(jPanel11Layout);
        jPanel11Layout.setHorizontalGroup(
            jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel11Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jpermisosagre)
                .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel11Layout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addComponent(jButton3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGroup(jPanel11Layout.createSequentialGroup()
                        .addGap(16, 16, 16)
                        .addComponent(jnuevopermiso, javax.swing.GroupLayout.DEFAULT_SIZE, 153, Short.MAX_VALUE)))
                .addContainerGap())
        );
        jPanel11Layout.setVerticalGroup(
            jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel11Layout.createSequentialGroup()
                .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jpermisosagre, javax.swing.GroupLayout.DEFAULT_SIZE, 62, Short.MAX_VALUE)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel11Layout.createSequentialGroup()
                        .addComponent(jnuevopermiso)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 16, Short.MAX_VALUE)
                        .addComponent(jButton3)))
                .addContainerGap())
        );

        jPanel12.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Manejo de Datos", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.BOTTOM, new java.awt.Font("Tahoma", 1, 11), new java.awt.Color(153, 102, 0))); // NOI18N

        jbackup.setText("Copia de Seguridad");
        jbackup.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
        jbackup.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jbackup.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbackupActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel12Layout = new javax.swing.GroupLayout(jPanel12);
        jPanel12.setLayout(jPanel12Layout);
        jPanel12Layout.setHorizontalGroup(
            jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel12Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jbackup)
                .addContainerGap(18, Short.MAX_VALUE))
        );
        jPanel12Layout.setVerticalGroup(
            jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel12Layout.createSequentialGroup()
                .addComponent(jbackup, javax.swing.GroupLayout.DEFAULT_SIZE, 62, Short.MAX_VALUE)
                .addContainerGap())
        );

        jPanel15.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Consultas sobre soporte", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.BOTTOM, new java.awt.Font("Tahoma", 1, 11), new java.awt.Color(153, 102, 0))); // NOI18N

        jfaq.setText("Preguntas frecuentes");

        jsoporte.setText("Contactar con Soporte Externo");

        javax.swing.GroupLayout jPanel15Layout = new javax.swing.GroupLayout(jPanel15);
        jPanel15.setLayout(jPanel15Layout);
        jPanel15Layout.setHorizontalGroup(
            jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel15Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jfaq, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 183, Short.MAX_VALUE)
                    .addComponent(jsoporte, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanel15Layout.setVerticalGroup(
            jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel15Layout.createSequentialGroup()
                .addComponent(jfaq)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jsoporte)
                .addContainerGap(16, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout tabmantenimientoLayout = new javax.swing.GroupLayout(tabmantenimiento);
        tabmantenimiento.setLayout(tabmantenimientoLayout);
        tabmantenimientoLayout.setHorizontalGroup(
            tabmantenimientoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, tabmantenimientoLayout.createSequentialGroup()
                .addComponent(jPanel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jPanel11, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel12, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jPanel15, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(215, 215, 215))
        );
        tabmantenimientoLayout.setVerticalGroup(
            tabmantenimientoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(tabmantenimientoLayout.createSequentialGroup()
                .addGroup(tabmantenimientoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(jPanel12, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel15, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel11, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel8, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap(24, Short.MAX_VALUE))
        );

        jmenu.addTab("Mantenimiento", new javax.swing.ImageIcon(getClass().getResource("/Imagenes/icono_mecanicos.png")), tabmantenimiento); // NOI18N

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jmenu, javax.swing.GroupLayout.DEFAULT_SIZE, 1227, Short.MAX_VALUE)
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jmenu, javax.swing.GroupLayout.PREFERRED_SIZE, 160, Short.MAX_VALUE)
        );

        getContentPane().add(jPanel1, java.awt.BorderLayout.PAGE_START);
        getContentPane().add(jdesktop, java.awt.BorderLayout.CENTER);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jalumnoporsemestre2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jalumnoporsemestre2ActionPerformed

        ListaEstadisticas lista = new ListaEstadisticas();
         int x = this.getSize().width -  lista.getSize().width;
         int y = this.jdesktop.getSize().height -  lista.getSize().height;
         lista.setLocation(x/2,y/2);
         lista.setClosable(true);
        lista.setResizable(true);
        lista.setMaximizable(true);
        lista.setIconifiable(true);
        lista.setTitle("Reportes Estadisticos");
        jdesktop.add(lista);
        lista.show();
}//GEN-LAST:event_jalumnoporsemestre2ActionPerformed

    private void jalumnoporsemestreActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jalumnoporsemestreActionPerformed
//        Dimension Tamanodesktop = jdesktop.getSize();
//        Dimension Tamanopantalla = this.getSize();


        try {
            alumno2 = new AlumnosporSemestre();
            int x = this.getSize().width - alumno2.getSize().width;
            int y = this.jdesktop.getSize().height - alumno2.getSize().height;
            alumno2.setLocation(x/2,y/2);
            alumno2.setClosable(true);
            alumno2.setResizable(true);
            alumno2.setMaximizable(true);
            alumno2.setIconifiable(true);
            alumno2.setTitle("Busqueda de Alumno por Semestre");
//            alumno2.setLocation((Tamanodesktop.width/2)-(alumno2.getWidth()/2), (altoinicial/2));
        } catch (Exception ex) {
            Logger.getLogger(Principal.class.getName()).log(Level.SEVERE, null, ex);
        }
        jdesktop.add(alumno2);
        alumno2.show();
    }//GEN-LAST:event_jalumnoporsemestreActionPerformed

    private void jalumnoporsemestre1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jalumnoporsemestre1ActionPerformed
    int x = this.getSize().width - buscar.getSize().width;
    int y = this.jdesktop.getSize().height - buscar.getSize().height;
    buscar.setLocation(x/2,y/2);
    jdesktop.add(buscar);
    buscar.show();
}//GEN-LAST:event_jalumnoporsemestre1ActionPerformed

    private void jbtnmoduloActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnmoduloActionPerformed
//        Dimension Tamanodesktop = jdesktop.getSize();
//        Dimension Tamanopantalla = this.getSize();
        int altoinicial = (int)  (jmenu.getHeight()-30);
        try {

            modulos = new modulos();
               int x = this.getSize().width -  modulos.getSize().width;
             int y = this.jdesktop.getSize().height -  modulos.getSize().height;
             modulos.setLocation(x/2,y/2);
            modulos.setClosable(true);
            modulos.setResizable(true);
            modulos.setMaximizable(true);
            modulos.setIconifiable(true);
            modulos.setTitle("Listado de Modulos/Unidades");
//            modulos.setLocation((Tamanodesktop.width/2)-(alumno2.getWidth()/2), (altoinicial/2));
        } catch (Exception ex) {
            Logger.getLogger(Principal.class.getName()).log(Level.SEVERE, null, ex);
        }
        jdesktop.add(modulos);
        modulos.show();
}//GEN-LAST:event_jbtnmoduloActionPerformed

    private void jbtncarreraActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtncarreraActionPerformed
//        Dimension Tamanodesktop = jdesktop.getSize();
//        Dimension Tamanopantalla = this.getSize();
        int altoinicial = (int)  (jmenu.getHeight()-30);
        try {
            carrera = new carrera();
             int x = this.getSize().width -  carrera.getSize().width;
             int y = this.jdesktop.getSize().height -  carrera.getSize().height;
             carrera.setLocation(x/2,y/2);
            carrera.setClosable(true);
            carrera.setResizable(true);
            carrera.setMaximizable(true);
            carrera.setIconifiable(true);
            carrera.setTitle("Listado de Carreras");
//            carrera.setLocation((Tamanodesktop.width/2)-(alumno2.getWidth()/2), (altoinicial/2));
        } catch (Exception ex) {
            Logger.getLogger(Principal.class.getName()).log(Level.SEVERE, null, ex);
        }
        jdesktop.add(carrera);
        carrera.show();
}//GEN-LAST:event_jbtncarreraActionPerformed

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
   AcercaDe acerca = new AcercaDe();
   acerca.setVisible(true);
   
    }//GEN-LAST:event_jButton2ActionPerformed

    private void jfichamatriculaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jfichamatriculaActionPerformed
  try{
    String matricula = JOptionPane.showInputDialog(null,"Por favor ingrese un número de matricula"+"\n"+"valido para generar el reporte","Número de Matricula",JOptionPane.INFORMATION_MESSAGE);
    if(matricula != null){
     ejecutarficha ejecutar = new ejecutarficha();
     ejecutar.ejecutarReporte(matricula);
     ejecutar.cerrar();
    }
  }catch(Exception e){
  
  }
  
  
    }//GEN-LAST:event_jfichamatriculaActionPerformed

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
    this.dispose();
    Login login = new Login();
    login.setVisible(true);
    }//GEN-LAST:event_jButton1ActionPerformed

    private void reportenominaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_reportenominaActionPerformed
     try {
            ReporteNomina nomina = new ReporteNomina();
            int x = this.getSize().width - nomina.getSize().width;
            int y = this.jdesktop.getSize().height - nomina.getSize().height;
            nomina.setLocation(x/2,y/2);
            nomina.setClosable(true);
            nomina.setResizable(true);
            nomina.setMaximizable(true);
            nomina.setIconifiable(true);
            nomina.setTitle("Busqueda de Alumno por Semestre");
             jdesktop.add(nomina);
                nomina.show();
//            alumno2.setLocation((Tamanodesktop.width/2)-(alumno2.getWidth()/2), (altoinicial/2));
        } catch (Exception ex) {
            Logger.getLogger(Principal.class.getName()).log(Level.SEVERE, null, ex);
        }
       
    }//GEN-LAST:event_reportenominaActionPerformed

    private void matricularActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_matricularActionPerformed
 try {
            proyectocatalina.matricula.newmatricula ingresar = new proyectocatalina.matricula.newmatricula();
            int x = this.getSize().width - ingresar.getSize().width;
            int y = this.jdesktop.getSize().height - ingresar.getSize().height;
            ingresar.setLocation(x/2,y/2);
            Principal.panel.add(ingresar);
            ingresar.show();
        } catch (Exception ex) {
            Logger.getLogger(Principal.class.getName()).log(Level.SEVERE, null, ex);
        }        // TODO add your handling code here:
    }//GEN-LAST:event_matricularActionPerformed

    private void newalumnoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newalumnoActionPerformed
 try {
            proyectocatalina.matricula.RegistrarAlumno2 ingresar = new proyectocatalina.matricula.RegistrarAlumno2();
            int x = this.getSize().width - ingresar.getSize().width;
            int y = this.jdesktop.getSize().height - ingresar.getSize().height;
            ingresar.setLocation(x/2,y/2);
            Principal.panel.add(ingresar);
            ingresar.show();
        } catch (Exception ex) {
            Logger.getLogger(Principal.class.getName()).log(Level.SEVERE, null, ex);
        }     
    }//GEN-LAST:event_newalumnoActionPerformed

    private void jbtnmodifcardatosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnmodifcardatosActionPerformed
    try {
            proyectocatalina.matricula.ActualizarAlumno ingresar = new proyectocatalina.matricula.ActualizarAlumno();
            int x = this.getSize().width - ingresar.getSize().width;
            int y = this.jdesktop.getSize().height - ingresar.getSize().height;
            ingresar.setLocation(x/2,y/2);
            Principal.panel.add(ingresar);
            ingresar.show();
        } catch (Exception ex) {
            Logger.getLogger(Principal.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_jbtnmodifcardatosActionPerformed

    private void jcarreraadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcarreraadActionPerformed
  try {
            proyectocatalina.mantenimiento.carrera ingresar = new  proyectocatalina.mantenimiento.carrera();
            int x = this.getSize().width - ingresar.getSize().width;
            int y = this.jdesktop.getSize().height - ingresar.getSize().height;
            ingresar.setLocation(x/2,y/2);
            Principal.panel.add(ingresar);
            ingresar.show();
        } catch (Exception ex) {
            Logger.getLogger(Principal.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_jcarreraadActionPerformed

    private void jperiodoadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jperiodoadActionPerformed
         try {
            proyectocatalina.mantenimiento.periodo_lectivo ingresar = new  proyectocatalina.mantenimiento.periodo_lectivo();
            int x = this.getSize().width - ingresar.getSize().width;
            int y = this.jdesktop.getSize().height - ingresar.getSize().height;
            ingresar.setLocation(x/2,y/2);
            Principal.panel.add(ingresar);
            ingresar.show();
        } catch (Exception ex) {
            Logger.getLogger(Principal.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_jperiodoadActionPerformed

    private void jsemestreadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jsemestreadActionPerformed

    }//GEN-LAST:event_jsemestreadActionPerformed

    private void jmodulosadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmodulosadActionPerformed
        try {
            proyectocatalina.mantenimiento.modulos ingresar = new  proyectocatalina.mantenimiento.modulos ();
            int x = this.getSize().width - ingresar.getSize().width;
            int y = this.jdesktop.getSize().height - ingresar.getSize().height;
            ingresar.setLocation(x/2,y/2);
            Principal.panel.add(ingresar);
            ingresar.show();
        } catch (Exception ex) {
            Logger.getLogger(Principal.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_jmodulosadActionPerformed

    private void junidadesadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_junidadesadActionPerformed
          try {
            proyectocatalina.mantenimiento.unidad ingresar = new  proyectocatalina.mantenimiento.unidad();
            int x = this.getSize().width - ingresar.getSize().width;
            int y = this.jdesktop.getSize().height - ingresar.getSize().height;
            ingresar.setLocation(x/2,y/2);
            Principal.panel.add(ingresar);
            ingresar.show();
        } catch (Exception ex) {
            Logger.getLogger(Principal.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_junidadesadActionPerformed

    private void jturnosadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jturnosadActionPerformed
       try {
            proyectocatalina.mantenimiento.turno ingresar = new  proyectocatalina.mantenimiento.turno();
            int x = this.getSize().width - ingresar.getSize().width;
            int y = this.jdesktop.getSize().height - ingresar.getSize().height;
            ingresar.setLocation(x/2,y/2);
            Principal.panel.add(ingresar);
            ingresar.show();
        } catch (Exception ex) {
            Logger.getLogger(Principal.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_jturnosadActionPerformed

    private void jorgterritorialadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jorgterritorialadActionPerformed
        try {
            proyectocatalina.mantenimiento.FormDepProSexo ingresar = new  proyectocatalina.mantenimiento.FormDepProSexo();
            int x = this.getSize().width - ingresar.getSize().width;
            int y = this.jdesktop.getSize().height - ingresar.getSize().height;
            ingresar.setLocation(x/2,y/2);
            Principal.panel.add(ingresar);
            ingresar.show();
        } catch (Exception ex) {
            Logger.getLogger(Principal.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_jorgterritorialadActionPerformed

    private void jactividadesadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jactividadesadActionPerformed
       try {
            proyectocatalina.mantenimiento.Actividad ingresar = new  proyectocatalina.mantenimiento.Actividad();
            int x = this.getSize().width - ingresar.getSize().width;
            int y = this.jdesktop.getSize().height - ingresar.getSize().height;
            ingresar.setLocation(x/2,y/2);
            Principal.panel.add(ingresar);
            ingresar.show();
        } catch (Exception ex) {
            Logger.getLogger(Principal.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_jactividadesadActionPerformed

    private void jcolegioadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcolegioadActionPerformed
        try {
            proyectocatalina.mantenimiento.Colegio ingresar = new  proyectocatalina.mantenimiento.Colegio();
            int x = this.getSize().width - ingresar.getSize().width;
            int y = this.jdesktop.getSize().height - ingresar.getSize().height;
            ingresar.setLocation(x/2,y/2);
            Principal.panel.add(ingresar);
            ingresar.show();
        } catch (Exception ex) {
            Logger.getLogger(Principal.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_jcolegioadActionPerformed

    private void jregistrarusuarioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jregistrarusuarioActionPerformed
         try {
            proyectocatalina.tablasystem.usuarios ingresar = new  proyectocatalina.tablasystem.usuarios();
            int x = this.getSize().width - ingresar.getSize().width;
            int y = this.jdesktop.getSize().height - ingresar.getSize().height;
            ingresar.setLocation(x/2,y/2);
            Principal.panel.add(ingresar);
            ingresar.show();
        } catch (Exception ex) {
            Logger.getLogger(Principal.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_jregistrarusuarioActionPerformed

    private void jpermisosagreActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jpermisosagreActionPerformed
       try {
            proyectocatalina.tablasystem.UsuarioSistemas ingresar = new   proyectocatalina.tablasystem.UsuarioSistemas();
            int x = this.getSize().width - ingresar.getSize().width;
            int y = this.jdesktop.getSize().height - ingresar.getSize().height;
            ingresar.setLocation(x/2,y/2);
            Principal.panel.add(ingresar);
            ingresar.show();
        } catch (Exception ex) {
            Logger.getLogger(Principal.class.getName()).log(Level.SEVERE, null, ex);
        }        // TODO add your handling code here:
    }//GEN-LAST:event_jpermisosagreActionPerformed

    private void jnuevopermisoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jnuevopermisoActionPerformed
       try {
            proyectocatalina.tablasystem.Permisos ingresar = new  proyectocatalina.tablasystem.Permisos();
            int x = this.getSize().width - ingresar.getSize().width;
            int y = this.jdesktop.getSize().height - ingresar.getSize().height;
            ingresar.setLocation(x/2,y/2);
            Principal.panel.add(ingresar);
            ingresar.show();
        } catch (Exception ex) {
            Logger.getLogger(Principal.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_jnuevopermisoActionPerformed

    private void jmodusuarioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmodusuarioActionPerformed
        try {
            proyectocatalina.tablasystem.modificarusuarios ingresar = new  proyectocatalina.tablasystem.modificarusuarios();
            int x = this.getSize().width - ingresar.getSize().width;
            int y = this.jdesktop.getSize().height - ingresar.getSize().height;
            ingresar.setLocation(x/2,y/2);
            Principal.panel.add(ingresar);
            ingresar.show();
        } catch (Exception ex) {
            Logger.getLogger(Principal.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_jmodusuarioActionPerformed

    private void jlistadousuarioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jlistadousuarioActionPerformed
    proyectocatalina.reportes.usuarios ejecutar = new proyectocatalina.reportes.usuarios();
    ejecutar.ejecutarReporte();
    ejecutar.cerrar();



    }//GEN-LAST:event_jlistadousuarioActionPerformed

    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
 
    proyectocatalina.reportes.permisosusuarios ejecutar = new proyectocatalina.reportes.permisosusuarios();
    ejecutar.ejecutarReporte();
    ejecutar.cerrar();
    }//GEN-LAST:event_jButton3ActionPerformed

    private void jactividaddiariaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jactividaddiariaActionPerformed
     proyectocatalina.reportes.useractividad ejecutar = new proyectocatalina.reportes.useractividad();
    ejecutar.ejecutarReporte();
    ejecutar.cerrar();
    }//GEN-LAST:event_jactividaddiariaActionPerformed

    private void jbackupActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbackupActionPerformed
        String host = ConexionBD.host;
        String usuario = ConexionBD.user;
        String password = ConexionBD.pass;
        String bd = ConexionBD.bd;
        Calendar c1 = Calendar.getInstance();
        int dia = c1.get(Calendar.DATE);
        int mes = c1.get(Calendar.MONTH)+1;
        int annio = c1.get(Calendar.YEAR);
        int hora23 = c1.get(Calendar.HOUR);
        int minutos32 = c1.get(Calendar.MINUTE);
        int segundo = c1.get(Calendar.SECOND);
        int diapm = c1.get(Calendar.AM_PM);
        String fecha = "" + annio + mes + dia + hora23 + minutos32 + segundo+diapm;
        StringTokenizer stTexto = new StringTokenizer(fecha.toString());
        String  sCadenaSinBlancos = "";
        while (stTexto.hasMoreElements())  sCadenaSinBlancos += stTexto.nextElement();
        String fecha2 = sCadenaSinBlancos+".sql";
        jf.setSelectedFile(new File(fecha2));
        FileNameExtensionFilter filtroImagen=new FileNameExtensionFilter("Archivos sql","sql");
        jf.setFileFilter(filtroImagen);
        int result = jf.showSaveDialog(null);
        if(result == JFileChooser.APPROVE_OPTION){
           String rutabck = jf.getSelectedFile().getAbsolutePath() ;
           BackUpSample h = new BackUpSample(host,usuario,password,rutabck,bd);
           SimpleThread st = new SimpleThread(h);
           if(h.CrearBackup()){
                st.start();
           }
        }
       
    }//GEN-LAST:event_jbackupActionPerformed

private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
         try {
            proyectocatalina.matricula.cambiar_matricula ingresar = new proyectocatalina.matricula.cambiar_matricula();
            int x = this.getSize().width - ingresar.getSize().width;
            int y = this.jdesktop.getSize().height - ingresar.getSize().height;
            ingresar.setLocation(x/2,y/2);
            Principal.panel.add(ingresar);
            ingresar.show();
        } catch (Exception ex) {
            Logger.getLogger(Principal.class.getName()).log(Level.SEVERE, null, ex);
        }
}//GEN-LAST:event_jButton4ActionPerformed

private void jitinerarioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jitinerarioActionPerformed
     try {
            proyectocatalina.mantenimiento.listadeunidades ingresar = new  proyectocatalina.mantenimiento.listadeunidades();
            int x = this.getSize().width - ingresar.getSize().width;
            int y = this.jdesktop.getSize().height - ingresar.getSize().height;
            ingresar.setLocation(x/2,y/2);
            Principal.panel.add(ingresar);
            ingresar.show();
        } catch (Exception ex) {
            Logger.getLogger(Principal.class.getName()).log(Level.SEVERE, null, ex);
        }
}//GEN-LAST:event_jitinerarioActionPerformed

private void jcondicionadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcondicionadActionPerformed
     try {
            proyectocatalina.mantenimiento.ingrcondicion ingresar = new proyectocatalina.mantenimiento.ingrcondicion();
            int x = this.getSize().width - ingresar.getSize().width;
            int y = this.jdesktop.getSize().height - ingresar.getSize().height;
            ingresar.setLocation(x/2,y/2);
            Principal.panel.add(ingresar);
            ingresar.show();
        } catch (Exception ex) {
            Logger.getLogger(Principal.class.getName()).log(Level.SEVERE, null, ex);
        }
}//GEN-LAST:event_jcondicionadActionPerformed

private void jrelacionaradActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jrelacionaradActionPerformed
  try {
            proyectocatalina.mantenimiento.newsemestreunidad ingresar = new proyectocatalina.mantenimiento.newsemestreunidad();
            int x = this.getSize().width - ingresar.getSize().width;
            int y = this.jdesktop.getSize().height - ingresar.getSize().height;
            ingresar.setLocation(x/2,y/2);
            Principal.panel.add(ingresar);
            ingresar.show();
        } catch (Exception ex) {
            Logger.getLogger(Principal.class.getName()).log(Level.SEVERE, null, ex);
        }
}//GEN-LAST:event_jrelacionaradActionPerformed

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException {

        java.awt.EventQueue.invokeLater(new Runnable() {
            @Override
            public void run() {          
                    try {
                        new Principal().setVisible(true);
                    } catch (UnsupportedLookAndFeelException ex) {
                        Logger.getLogger(Principal.class.getName()).log(Level.SEVERE, null, ex);
                    } catch (Exception ex) {
                        Logger.getLogger(Principal.class.getName()).log(Level.SEVERE, null, ex);
                    }
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel Jhora;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton13;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButton4;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel10;
    private javax.swing.JPanel jPanel11;
    private javax.swing.JPanel jPanel12;
    private javax.swing.JPanel jPanel13;
    private javax.swing.JPanel jPanel14;
    private javax.swing.JPanel jPanel15;
    private javax.swing.JPanel jPanel16;
    private javax.swing.JPanel jPanel17;
    private javax.swing.JPanel jPanel18;
    private javax.swing.JPanel jPanel20;
    private javax.swing.JPanel jPanel21;
    private javax.swing.JPanel jPanel22;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JToolBar.Separator jSeparator1;
    private javax.swing.JToolBar.Separator jSeparator2;
    private javax.swing.JToolBar.Separator jSeparator3;
    private javax.swing.JToolBar.Separator jSeparator4;
    private javax.swing.JToolBar.Separator jSeparator5;
    private javax.swing.JToolBar jToolBar1;
    private javax.swing.JButton jactividaddiaria;
    private javax.swing.JButton jactividadesad;
    private javax.swing.JButton jalumnoporsemestre;
    private javax.swing.JButton jalumnoporsemestre1;
    private javax.swing.JButton jalumnoporsemestre2;
    private javax.swing.JButton jbackup;
    private javax.swing.JButton jbtncarrera;
    private javax.swing.JButton jbtnmodifcardatos;
    private javax.swing.JButton jbtnmodulo;
    private javax.swing.JLabel jcargo;
    private javax.swing.JButton jcarreraad;
    private javax.swing.JButton jcolegioad;
    private javax.swing.JButton jcondicionad;
    private javax.swing.JDesktopPane jdesktop;
    private javax.swing.JFileChooser jf;
    private javax.swing.JButton jfaq;
    private javax.swing.JLabel jfecha;
    private javax.swing.JButton jfichamatricula;
    private javax.swing.JButton jitinerario;
    private javax.swing.JButton jlistadousuario;
    private javax.swing.JTabbedPane jmenu;
    private javax.swing.JButton jmodulosad;
    private javax.swing.JButton jmodusuario;
    private javax.swing.JButton jnuevopermiso;
    private javax.swing.JButton jorgterritorialad;
    private javax.swing.JButton jperiodoad;
    private javax.swing.JButton jpermisosagre;
    private javax.swing.JButton jregistrarusuario;
    private javax.swing.JButton jrelacionarad;
    private javax.swing.JButton jretiraralumno;
    private javax.swing.JButton jsemestread;
    private javax.swing.JButton jsoporte;
    private javax.swing.JButton jturnosad;
    private javax.swing.JButton junidadesad;
    private javax.swing.JButton matricular;
    private javax.swing.JButton newalumno;
    private javax.swing.JButton reportenomina;
    private javax.swing.JPanel tabadministracion;
    private javax.swing.JPanel tabconsultas;
    private javax.swing.JPanel tabmantenimiento;
    private javax.swing.JPanel tabmatricula;
    private javax.swing.JPanel tabreportes;
    // End of variables declaration//GEN-END:variables

    public void run() {
        Thread ct = Thread.currentThread();
        while(ct == h1) {
        calcula();
        String b =  hora + ":" + minutos + ":" + segundos + " "+ampm;
        Jhora.setText(b);
        try {
        Thread.sleep(1000);
    }catch(InterruptedException e) {}
    }
    }

private void activarpermiso(){
       ArrayList formulariosdisponibles = DaoUsuariosSistemas.formulariosdisponibles(User.getUsuario());
       beanPermisos[] formularios = new beanPermisos[formulariosdisponibles.size()];
       Iterator itr = formulariosdisponibles.iterator();
       int j = 0;
       JPanel[] jp = {this.tabmatricula,this.tabconsultas,this.tabreportes, this.tabadministracion,this.tabmantenimiento};

       while (itr.hasNext()) {
          formularios[j] =  (beanPermisos) itr.next();         
          if(formularios[j].getTipo().toString().equalsIgnoreCase("Grupo")){
            if(formularios[j].getForm().equalsIgnoreCase("Inicio")){
//                boolean enabled;
//                if(formularios[j].getOpcion().equalsIgnoreCase("Permitir")) enabled = true;
//                else enabled = false;
//                activarJButton(jp[0],enabled);                
            }else{
            if(formularios[j].getForm().equalsIgnoreCase("Matricula")){
                boolean enabled;
                if(formularios[j].getOpcion().equalsIgnoreCase("Permitir")) enabled = true;
                else enabled = false;
                activarJButton(jp[0],enabled);
                     
            }else{
            if(formularios[j].getForm().equalsIgnoreCase("Consultas")){
                boolean enabled;
                if(formularios[j].getOpcion().equalsIgnoreCase("Permitir")) enabled = true;
                else enabled = false;
                activarJButton(jp[1],enabled);
               
            }else{
            if(formularios[j].getForm().equalsIgnoreCase("Reportes")){
                boolean enabled;
                if(formularios[j].getOpcion().equalsIgnoreCase("Permitir")) enabled = true;
                else enabled = false;
                activarJButton(jp[2],enabled);
         
            }else{
            if(formularios[j].getForm().equalsIgnoreCase("Administracion")){
                boolean enabled;
                if(formularios[j].getOpcion().equalsIgnoreCase("Permitir")) enabled = true;
                else enabled = false;
                activarJButton(jp[3],enabled);
         
            }else{
            if(formularios[j].getForm().equalsIgnoreCase("Mantenimiento")){
                boolean enabled;
                if(formularios[j].getOpcion().equalsIgnoreCase("Permitir")) enabled = true;
                else enabled = false;
                activarJButton(jp[4],enabled);
                  
            }
            }
            }
            }
            }
           }
          }
          j++;
      }

}
private void activarJButton(Container c, boolean enabled) {
		Component Component[] = c.getComponents(); //obtenemos los componentes en un array de tipo Component
		
                for (int i = 0; i <= Component.length - 1; i++) {
                    Container d = (Container) Component[i];
                    Component Componentes[] = d.getComponents();
                     for (int z = 0; z <= Componentes.length - 1; z++){
                         Componentes[z].setEnabled(enabled);
                     }
                    //activamos o desactivamos el JButton
		}
	}
public void calcula () {
calendario = new GregorianCalendar();
Date fechaHoraActual = new Date();
calendario.setTime(fechaHoraActual);
ampm = calendario.get(Calendar.AM_PM)==Calendar.AM?"AM":"PM";
if(ampm.equals("PM")){
 int h = calendario.get(Calendar.HOUR_OF_DAY)-12;
 hora = h>9?""+h:"0"+h;
}else{
 hora = calendario.get(Calendar.HOUR_OF_DAY)>9?""+calendario.get(Calendar.HOUR_OF_DAY):"0"+calendario.get(Calendar.HOUR_OF_DAY);
}
minutos = calendario.get(Calendar.MINUTE)>9?""+calendario.get(Calendar.MINUTE):"0"+calendario.get(Calendar.MINUTE);
segundos = calendario.get(Calendar.SECOND)>9?""+calendario.get(Calendar.SECOND):"0"+calendario.get(Calendar.SECOND);
}
 

    // End of variables declaration

}
